package scenario;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;

import terrain.HighWallRect;
import terrain.LowWallRect;
import unit.*;
import equipment.*;
import fellowship.*;
import main.Army;
import main.Battle;
import main.Board;
import main.Game;
import main.Unit;
import main.Utils;

public class ObstacleTest extends Game {
	public ObstacleTest() {
		Board b = new Board(36, 36);
		File imFile = new File("scenario/Plains_1080_1080.png");
		try {
			b.background = ImageIO.read(imFile);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		LowWallRect t = new LowWallRect(6*Utils.pixelsPerInch, 2*Utils.pixelsPerInch,
				Utils.pixelsPerInch/2, 3*Utils.pixelsPerInch, Math.PI/4);
		HighWallRect t2 = new HighWallRect(2*Utils.pixelsPerInch, 4*Utils.pixelsPerInch,
				Utils.pixelsPerInch/2, 3*Utils.pixelsPerInch, 0.1);
		
		b.addTerrain(t);
		b.addTerrain(t2);
		board = b;
		b.game = this;
		
		Unit mt1 = new WarriorMinasTirith(1,0,20,20);
		mt1.equip(new Bow());
		Unit lgl = new Aragorn(2,0,45,45);
//		mt2.equip(new Shield());
		Unit th = new Frodo(3,0,215,45);
		
		ArrayList<Unit> good = new ArrayList<Unit>();
		good.add(mt1);
		good.add(lgl);
		good.add(th);
		

		Unit o1 = new Orc(11,1,200,200);
		o1.equip(new OrcBow());
		Unit o2 = new CaveTroll(12,1,175,240);
		Unit th2 = new TestHero(13,1,225,225);
		
		ArrayList<Unit> bad = new ArrayList<Unit>();
		bad.add(o1);
		bad.add(o2);
		bad.add(th2);
		
		Army goodArmy = new Army(good, this);
		Army badArmy = new Army(bad, this);
		goodArmy.addToGame(this);
		badArmy.addToGame(this);
		armies[0] = goodArmy;
		armies[1] = badArmy;
		armiesPlaced = true;
		battles = new ArrayList<Battle>();
		priority = 0;
		currArmy = 0;
		currPhase = "Move";
	}
	
	public int winConditions() {
		return -1;
	}
}
